﻿
Ext.namespace('FantastPlatform', 'FantastPlatform.UI');
FantastPlatform.UI.HandBookForm = function (config) {
    Ext.apply(this, config);

    this.items = [{
        layout: 'column',
        border: false,
        labelSeparator: '：',
        items: [{
            columnWidth: 1,
            border: false,
            layout: 'form',
            items: [new Ext.form.TextArea({
                fieldLabel: '办事指南内容',
                name: 'Content',
                allowBlank: false,
                blankText: " 办事指南内容不能为空",
                height: 130,
                width: 300
            })]
        }]
    }];

    FantastPlatform.UI.HandBookForm.superclass.constructor.call(this, {
        bodyStyle: 'padding:5px',
        collapsible: true,
        labelAlign: 'right',
        autoScroll: true,
        border: false
    });
};

Ext.extend(FantastPlatform.UI.HandBookForm, Ext.form.FormPanel, {
    onRender: function (ct, position) {
        FantastPlatform.UI.HandBookForm.superclass.onRender.call(this, ct, position);
        if (this.HandBookId && this.HandBookId != 0) {
            this.add(new Ext.form.Hidden({ name: 'Id', value: this.HandBookId }));
            this.form.load({
                url: '../Service/HandBook.aspx?Action=Get',
                params: { id: this.HandBookId },
                waitMsg: '正在读取数据...',
                waitTitle: '请稍后...',
                failure: function (form, action) {
                    if (action.failureType != 'client') {
                        showErrorMessage('操作失败', action.result.message, '');
                    }
                }
            });
        }
    }
});

